import { addManyTower, delManyTower, findAllTower } from '@/apis/towerAPI'
import { ref } from 'vue'

export default () => {
  const towers = ref<TowerViewModel[]>()

  async function addMany(arr: TowerModel[]) {
    await addManyTower(arr)
  }

  async function delMany(id: number) {
    await delManyTower(id)
  }

  async function all(args: Record<string, any>) {
    const { data } = await findAllTower(args)
    towers.value = data
  }

  return { all, addMany, delMany, towers }
}
